package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	Mysql
}
type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

var AppCig *AppConfig

func App() {
	var err error
	viper.SetConfigFile("appconfig/dev.yaml")
	err = viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&AppCig)
	if err != nil {
		panic(err)
	}
	fmt.Println("配置文件加载成功", AppCig)
}
